package org.rbreznak.tronco.client;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JLabel;
import javax.swing.Timer;

public class ScreenLast extends Screen {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private JLabel statusText = new JLabel();
	
	private Timer timer;
	
	public ScreenLast() {
		setLayout(new BorderLayout());
		setBackground(new Color(0,0,0));
		
		FormatUI.formatLabel(statusText);
		
		add(statusText, BorderLayout.SOUTH);
		
		statusText.setText("Your session has been loged and you are now signed out.");
		
		this.setVisible(true);
	}
	
	public void init() {
		timer = new javax.swing.Timer(3000, new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				timer.stop();
				_fireScreenUpdate();
			}
		});
		timer.start();
	}
	
	@Override
	public void decideNext() {
		if(nodes.size() > 0) {
			setNext(nodes.get(0));
		}
	}
	
	@Override
	public String toString() {
		return statusText.getText();
	}

	@Override
	public void reset() {
		setNext(null);
	}

}
